using System;
using System.Collections;

namespace monoServer
{
	public class SessionManager
	{
		private ArrayList _sessions;
		public ArrayList sessions
		{
			get {
				return this._sessions;
			}
		}
		
		public SessionManager ()
		{
			this._sessions = new ArrayList();
		}
		
		public void addSession(Session s)
		{
			this._sessions.Add(s);
		}
		
		public void removeSession(Session s)
		{
			this._sessions.Remove(s);
		}
		
		public void broadcast(Telegram t)
		{
			for (int i=0; i<=this._sessions.Count-1; i++) {
				((Session)this._sessions[i]).com.sendTelegram(t);
			}
		}
		
		public void logoutAll()
		{
			for(int i=0; i<=this._sessions.Count-1; i++)
			{
				((Session)this._sessions[i]).logout();
			}
		}
	}
}

